import request from '@/utils/request'

// 封装获取组织架构列表数据接口
export const getDepartments = () => {
  return request({
    url: '/company/department'
  })
}

// 封装删除组织架构接口
export const delDepartmentsById = (id) => {
  return request({
    method: 'DELETE',
    url: `/company/department/${id}`
  })
}

// 封装添加组织架构接口
export const addDepartments = data => {
  return request({
    method: 'POST',
    url: '/company/department',
    data
  })
}

// 根据id查询部门详情  接口作用：实现数据部门数据回显
export const getDepartmentsById = (id) => {
  return request({
    url: `/company/department/${id}`
  })
}

// 根据id修改部门
export const editDepartments = data => {
  return request({
    method: 'PUT',
    url: `/company/department/${data.id}`,
    data
  })
}
